/**
 * 
 */
package org.seckill.util.executor;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * 
 * @author yue
 * 2016年6月9日 下午7:24:04
 */
public class PrintStringThread implements Runnable {

	private int num;
	private List<String> strList;
	private int threadNum;
	
	public PrintStringThread(int num, List<String> strList, int threadNum) {
		this.num = num;
		this.strList = strList;
		this.threadNum = threadNum;
	}
	
	/* 
	 *  
	 */
	@Override
	public void run() {
		int n = 0;
		for (int i = 0;i < strList.size();i++) {
			if(i % threadNum == num){
				System.out.println("线程编号：" + num + "，字符串：" + strList.get(i) +" "+i+" "+threadNum);
				n++;
			}
		}
		try {
			System.out.println("线程编号：" + num +" 执行任务数："+n);
			Thread.sleep(TimeUnit.SECONDS.toMillis(10));
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}
